logging: Integrate score_log#73
Conversation
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //:license-checkStatus: Click to expand output |
|
The created documentation from the pull request is available at: docu-html |
Integrated score_log under score-log feature with appropriate refactoring in the source code.
6d93f45 to
c07aed8
Compare
|
|
||
| use kyron_foundation::prelude::{error, CommonErrors}; | ||
| use crate::macros::k_log::*; | ||
| #[cfg(feature = "score-log")] |
There was a problem hiding this comment.
there must be no ifdefs in code base. It shall be completely hidden from code base
| }, | ||
| Err(e) => { | ||
| error!("Error reading from mio object: {}", e); | ||
| k_error!("Error reading from mio object: {}", &format!("{}", e)); |
There was a problem hiding this comment.
no strange names, shall be names as usual for log
| fn fmt( | ||
| &self, | ||
| f: &mut dyn kyron_foundation::prelude::ScoreWrite, | ||
| spec: &kyron_foundation::prelude::FormatSpec, |
There was a problem hiding this comment.
export in such a way that original signature is kept. Look into lifecycle repo or persistency.
|
|
||
| use crate::{ | ||
| core::types::TaskId, | ||
| kore::types::TaskId, |
There was a problem hiding this comment.
We get two errors as shown below for all the instances of not_recoverable_error!() in src/kyron/src/lib.rs. Because core::module_path and core::panic are used in score_log which is not available in our core. So, to avoid confusion, re-exporting such items now and future, changed our core to kore.
error[E0433]: failed to resolve: could not find module_path in core
--> src/kyron/src/lib.rs:158:9
|
158 | not_recoverable_error!("For now we don't allow runtime API to be called outside of runtime")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find module_path in core
|
= note: this error originates in the macro $crate::__log which comes from the expansion of the macro not_recoverable_error (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0433]: failed to resolve: could not find panic in core
--> src/kyron/src/lib.rs:103:9
|
103 | not_recoverable_error!("For now we don't allow runtime API to be called outside of runtime")
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ could not find panic in core
|
= note: this error originates in the macro $crate::__log which comes from the expansion of the macro not_recoverable_error (in Nightly builds, run with -Z macro-backtrace for more info)
| drop(_guard); // We need to drop the lock before going into IO wait | ||
|
|
||
| debug!("Parking on IO Driver with timeout: {:?}", timeout); | ||
| k_debug!("Parking on IO Driver with timeout: {:?}", &format!("{:?}", timeout)); |
There was a problem hiding this comment.
why such splits with seeprate format, shall not be like that.
There was a problem hiding this comment.
We get error for not implementing the trait ScoreDebug for Duration and similarly for other types in other places. So, added format() for such instances.
error[E0277]: the trait bound Duration: kyron_foundation::prelude::ScoreDebug is not satisfied
--> src/kyron/src/scheduler/workers/worker_types.rs:165:13
|
165 | k_debug!("Parking on IO Driver with timeout: {:?}", timeout);
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait kyron_foundation::prelude::ScoreDebug is not implemented for Duration
|
= help: the following other types implement trait kyron_foundation::prelude::ScoreDebug:
&T
&mut T
()
Arc
Box
FromUtf8Error
HashMap<K, V, S>
IoEventInterest
and 35 others
= note: required for Option<Duration> to implement kyron_foundation::prelude::ScoreDebug
note: required by a bound in kyron_foundation::prelude::score_log::score_log_fmt::Placeholder::<'a>::new
--> external/score_baselibs_rust+/src/log/score_log_fmt/fmt.rs:73:4
= note: this error originates in the macro $crate::format_args which comes from the expansion of the macro k_debug (in Nightly builds, run with -Z macro-backtrace for more info)
Integrated score_log under score-log feature with appropriate refactoring in the source code.
Notes for Reviewer
Pre-Review Checklist for the PR Author
Checklist for the PR Reviewer
Post-review Checklist for the PR Author
References
Closes #67